\(\int \sqrt {b \sec (c+d x)} (B \sec (c+d x)+C \sec ^2(c+d x)) \, dx\) [48]

   Optimal result
   Rubi [A] (verified)
   Mathematica [A] (verified)
   Maple [C] (verified)
   Fricas [C] (verification not implemented)
   Sympy [F]
   Maxima [F]
   Giac [F]
   Mupad [F(-1)]

Optimal result

Integrand size = 32, antiderivative size = 135 \[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=-\frac {2 b B E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}}+\frac {2 C \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {b \sec (c+d x)}}{3 d}+\frac {2 B \sqrt {b \sec (c+d x)} \sin (c+d x)}{d}+\frac {2 C (b \sec (c+d x))^{3/2} \sin (c+d x)}{3 b d} \]

[Out]

2/3*C*(b*sec(d*x+c))^(3/2)*sin(d*x+c)/b/d-2*b*B*(cos(1/2*d*x+1/2*c)^2)^(1/2)/cos(1/2*d*x+1/2*c)*EllipticE(sin(
1/2*d*x+1/2*c),2^(1/2))/d/cos(d*x+c)^(1/2)/(b*sec(d*x+c))^(1/2)+2*B*sin(d*x+c)*(b*sec(d*x+c))^(1/2)/d+2/3*C*(c
os(1/2*d*x+1/2*c)^2)^(1/2)/cos(1/2*d*x+1/2*c)*EllipticF(sin(1/2*d*x+1/2*c),2^(1/2))*cos(d*x+c)^(1/2)*(b*sec(d*
x+c))^(1/2)/d

Rubi [A] (verified)

Time = 0.13 (sec) , antiderivative size = 135, normalized size of antiderivative = 1.00, number of steps used = 9, number of rules used = 7, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.219, Rules used = {4132, 3853, 3856, 2719, 12, 16, 2720} \[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {2 B \sin (c+d x) \sqrt {b \sec (c+d x)}}{d}-\frac {2 b B E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}}+\frac {2 C \sin (c+d x) (b \sec (c+d x))^{3/2}}{3 b d}+\frac {2 C \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {b \sec (c+d x)}}{3 d} \]

[In]

Int[Sqrt[b*Sec[c + d*x]]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

(-2*b*B*EllipticE[(c + d*x)/2, 2])/(d*Sqrt[Cos[c + d*x]]*Sqrt[b*Sec[c + d*x]]) + (2*C*Sqrt[Cos[c + d*x]]*Ellip
ticF[(c + d*x)/2, 2]*Sqrt[b*Sec[c + d*x]])/(3*d) + (2*B*Sqrt[b*Sec[c + d*x]]*Sin[c + d*x])/d + (2*C*(b*Sec[c +
 d*x])^(3/2)*Sin[c + d*x])/(3*b*d)

Rule 12

Int[(a_)*(u_), x_Symbol] :> Dist[a, Int[u, x], x] /; FreeQ[a, x] &&  !MatchQ[u, (b_)*(v_) /; FreeQ[b, x]]

Rule 16

Int[(u_.)*(v_)^(m_.)*((b_)*(v_))^(n_), x_Symbol] :> Dist[1/b^m, Int[u*(b*v)^(m + n), x], x] /; FreeQ[{b, n}, x
] && IntegerQ[m]

Rule 2719

Int[Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticE[(1/2)*(c - Pi/2 + d*x), 2], x] /; FreeQ[{
c, d}, x]

Rule 2720

Int[1/Sqrt[sin[(c_.) + (d_.)*(x_)]], x_Symbol] :> Simp[(2/d)*EllipticF[(1/2)*(c - Pi/2 + d*x), 2], x] /; FreeQ
[{c, d}, x]

Rule 3853

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Simp[(-b)*Cos[c + d*x]*((b*Csc[c + d*x])^(n - 1)/(d*(n
- 1))), x] + Dist[b^2*((n - 2)/(n - 1)), Int[(b*Csc[c + d*x])^(n - 2), x], x] /; FreeQ[{b, c, d}, x] && GtQ[n,
 1] && IntegerQ[2*n]

Rule 3856

Int[(csc[(c_.) + (d_.)*(x_)]*(b_.))^(n_), x_Symbol] :> Dist[(b*Csc[c + d*x])^n*Sin[c + d*x]^n, Int[1/Sin[c + d
*x]^n, x], x] /; FreeQ[{b, c, d}, x] && EqQ[n^2, 1/4]

Rule 4132

Int[(csc[(e_.) + (f_.)*(x_)]*(b_.))^(m_.)*((A_.) + csc[(e_.) + (f_.)*(x_)]*(B_.) + csc[(e_.) + (f_.)*(x_)]^2*(
C_.)), x_Symbol] :> Dist[B/b, Int[(b*Csc[e + f*x])^(m + 1), x], x] + Int[(b*Csc[e + f*x])^m*(A + C*Csc[e + f*x
]^2), x] /; FreeQ[{b, e, f, A, B, C, m}, x]

Rubi steps \begin{align*} \text {integral}& = \frac {B \int (b \sec (c+d x))^{3/2} \, dx}{b}+\int C \sec ^2(c+d x) \sqrt {b \sec (c+d x)} \, dx \\ & = \frac {2 B \sqrt {b \sec (c+d x)} \sin (c+d x)}{d}-(b B) \int \frac {1}{\sqrt {b \sec (c+d x)}} \, dx+C \int \sec ^2(c+d x) \sqrt {b \sec (c+d x)} \, dx \\ & = \frac {2 B \sqrt {b \sec (c+d x)} \sin (c+d x)}{d}+\frac {C \int (b \sec (c+d x))^{5/2} \, dx}{b^2}-\frac {(b B) \int \sqrt {\cos (c+d x)} \, dx}{\sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}} \\ & = -\frac {2 b B E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}}+\frac {2 B \sqrt {b \sec (c+d x)} \sin (c+d x)}{d}+\frac {2 C (b \sec (c+d x))^{3/2} \sin (c+d x)}{3 b d}+\frac {1}{3} C \int \sqrt {b \sec (c+d x)} \, dx \\ & = -\frac {2 b B E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}}+\frac {2 B \sqrt {b \sec (c+d x)} \sin (c+d x)}{d}+\frac {2 C (b \sec (c+d x))^{3/2} \sin (c+d x)}{3 b d}+\frac {1}{3} \left (C \sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}\right ) \int \frac {1}{\sqrt {\cos (c+d x)}} \, dx \\ & = -\frac {2 b B E\left (\left .\frac {1}{2} (c+d x)\right |2\right )}{d \sqrt {\cos (c+d x)} \sqrt {b \sec (c+d x)}}+\frac {2 C \sqrt {\cos (c+d x)} \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right ) \sqrt {b \sec (c+d x)}}{3 d}+\frac {2 B \sqrt {b \sec (c+d x)} \sin (c+d x)}{d}+\frac {2 C (b \sec (c+d x))^{3/2} \sin (c+d x)}{3 b d} \\ \end{align*}

Mathematica [A] (verified)

Time = 0.53 (sec) , antiderivative size = 90, normalized size of antiderivative = 0.67 \[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {(b \sec (c+d x))^{3/2} \left (-6 B \cos ^{\frac {3}{2}}(c+d x) E\left (\left .\frac {1}{2} (c+d x)\right |2\right )+2 C \cos ^{\frac {3}{2}}(c+d x) \operatorname {EllipticF}\left (\frac {1}{2} (c+d x),2\right )+2 (C+3 B \cos (c+d x)) \sin (c+d x)\right )}{3 b d} \]

[In]

Integrate[Sqrt[b*Sec[c + d*x]]*(B*Sec[c + d*x] + C*Sec[c + d*x]^2),x]

[Out]

((b*Sec[c + d*x])^(3/2)*(-6*B*Cos[c + d*x]^(3/2)*EllipticE[(c + d*x)/2, 2] + 2*C*Cos[c + d*x]^(3/2)*EllipticF[
(c + d*x)/2, 2] + 2*(C + 3*B*Cos[c + d*x])*Sin[c + d*x]))/(3*b*d)

Maple [C] (verified)

Result contains complex when optimal does not.

Time = 2.88 (sec) , antiderivative size = 534, normalized size of antiderivative = 3.96

method result size
parts \(\frac {2 B \left (i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \cos \left (d x +c \right )^{2}-i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticE}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \cos \left (d x +c \right )^{2}+2 i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \cos \left (d x +c \right )-2 i \operatorname {EllipticE}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )+i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right )-i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticE}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right )+\sin \left (d x +c \right )\right ) \sqrt {b \sec \left (d x +c \right )}}{d \left (\cos \left (d x +c \right )+1\right )}-\frac {2 C \sqrt {b \sec \left (d x +c \right )}\, \left (i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \cos \left (d x +c \right )+i \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right )-\tan \left (d x +c \right )\right )}{3 d}\) \(534\)
default \(\frac {2 \sqrt {b \sec \left (d x +c \right )}\, \left (3 i B \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )^{2}-3 i B \operatorname {EllipticE}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )^{2}-i C \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )^{2}+6 i B \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )-6 i B \operatorname {EllipticE}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )-2 i C \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right ) \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \cos \left (d x +c \right )+3 i B \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right )-3 i B \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticE}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right )-i C \sqrt {\frac {1}{\cos \left (d x +c \right )+1}}\, \sqrt {\frac {\cos \left (d x +c \right )}{\cos \left (d x +c \right )+1}}\, \operatorname {EllipticF}\left (i \left (-\cot \left (d x +c \right )+\csc \left (d x +c \right )\right ), i\right )+3 B \sin \left (d x +c \right )+C \sin \left (d x +c \right )+C \tan \left (d x +c \right )\right )}{3 d \left (\cos \left (d x +c \right )+1\right )}\) \(598\)

[In]

int((b*sec(d*x+c))^(1/2)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x,method=_RETURNVERBOSE)

[Out]

2*B/d*(I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(I*(-cot(d*x+c)+csc(d*x+c)),I)*co
s(d*x+c)^2-I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticE(I*(-cot(d*x+c)+csc(d*x+c)),I
)*cos(d*x+c)^2+2*I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(I*(-cot(d*x+c)+csc(d*x
+c)),I)*cos(d*x+c)-2*I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticE(I*(-cot(d*x+c)+csc
(d*x+c)),I)*cos(d*x+c)+I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(I*(-cot(d*x+c)+c
sc(d*x+c)),I)-I*(1/(cos(d*x+c)+1))^(1/2)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticE(I*(-cot(d*x+c)+csc(d*x+c)
),I)+sin(d*x+c))*(b*sec(d*x+c))^(1/2)/(cos(d*x+c)+1)-2/3*C/d*(b*sec(d*x+c))^(1/2)*(I*(1/(cos(d*x+c)+1))^(1/2)*
(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(I*(-cot(d*x+c)+csc(d*x+c)),I)*cos(d*x+c)+I*(1/(cos(d*x+c)+1))^(1/2
)*(cos(d*x+c)/(cos(d*x+c)+1))^(1/2)*EllipticF(I*(-cot(d*x+c)+csc(d*x+c)),I)-tan(d*x+c))

Fricas [C] (verification not implemented)

Result contains higher order function than in optimal. Order 9 vs. order 4.

Time = 0.09 (sec) , antiderivative size = 183, normalized size of antiderivative = 1.36 \[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\frac {-i \, \sqrt {2} C \sqrt {b} \cos \left (d x + c\right ) {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right ) + i \, \sqrt {2} C \sqrt {b} \cos \left (d x + c\right ) {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right ) - 3 i \, \sqrt {2} B \sqrt {b} \cos \left (d x + c\right ) {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) + i \, \sin \left (d x + c\right )\right )\right ) + 3 i \, \sqrt {2} B \sqrt {b} \cos \left (d x + c\right ) {\rm weierstrassZeta}\left (-4, 0, {\rm weierstrassPInverse}\left (-4, 0, \cos \left (d x + c\right ) - i \, \sin \left (d x + c\right )\right )\right ) + 2 \, {\left (3 \, B \cos \left (d x + c\right ) + C\right )} \sqrt {\frac {b}{\cos \left (d x + c\right )}} \sin \left (d x + c\right )}{3 \, d \cos \left (d x + c\right )} \]

[In]

integrate((b*sec(d*x+c))^(1/2)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="fricas")

[Out]

1/3*(-I*sqrt(2)*C*sqrt(b)*cos(d*x + c)*weierstrassPInverse(-4, 0, cos(d*x + c) + I*sin(d*x + c)) + I*sqrt(2)*C
*sqrt(b)*cos(d*x + c)*weierstrassPInverse(-4, 0, cos(d*x + c) - I*sin(d*x + c)) - 3*I*sqrt(2)*B*sqrt(b)*cos(d*
x + c)*weierstrassZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) + I*sin(d*x + c))) + 3*I*sqrt(2)*B*sqrt(
b)*cos(d*x + c)*weierstrassZeta(-4, 0, weierstrassPInverse(-4, 0, cos(d*x + c) - I*sin(d*x + c))) + 2*(3*B*cos
(d*x + c) + C)*sqrt(b/cos(d*x + c))*sin(d*x + c))/(d*cos(d*x + c))

Sympy [F]

\[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \sqrt {b \sec {\left (c + d x \right )}} \left (B + C \sec {\left (c + d x \right )}\right ) \sec {\left (c + d x \right )}\, dx \]

[In]

integrate((b*sec(d*x+c))**(1/2)*(B*sec(d*x+c)+C*sec(d*x+c)**2),x)

[Out]

Integral(sqrt(b*sec(c + d*x))*(B + C*sec(c + d*x))*sec(c + d*x), x)

Maxima [F]

\[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int { {\left (C \sec \left (d x + c\right )^{2} + B \sec \left (d x + c\right )\right )} \sqrt {b \sec \left (d x + c\right )} \,d x } \]

[In]

integrate((b*sec(d*x+c))^(1/2)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="maxima")

[Out]

integrate((C*sec(d*x + c)^2 + B*sec(d*x + c))*sqrt(b*sec(d*x + c)), x)

Giac [F]

\[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int { {\left (C \sec \left (d x + c\right )^{2} + B \sec \left (d x + c\right )\right )} \sqrt {b \sec \left (d x + c\right )} \,d x } \]

[In]

integrate((b*sec(d*x+c))^(1/2)*(B*sec(d*x+c)+C*sec(d*x+c)^2),x, algorithm="giac")

[Out]

integrate((C*sec(d*x + c)^2 + B*sec(d*x + c))*sqrt(b*sec(d*x + c)), x)

Mupad [F(-1)]

Timed out. \[ \int \sqrt {b \sec (c+d x)} \left (B \sec (c+d x)+C \sec ^2(c+d x)\right ) \, dx=\int \left (\frac {B}{\cos \left (c+d\,x\right )}+\frac {C}{{\cos \left (c+d\,x\right )}^2}\right )\,\sqrt {\frac {b}{\cos \left (c+d\,x\right )}} \,d x \]

[In]

int((B/cos(c + d*x) + C/cos(c + d*x)^2)*(b/cos(c + d*x))^(1/2),x)

[Out]

int((B/cos(c + d*x) + C/cos(c + d*x)^2)*(b/cos(c + d*x))^(1/2), x)